subroutine regula_falsi(fungsi, a, b, c, eps, eps_mesin, delta)
	implicit none
	DOUBLE PRECISION fungsi, a, b, c, eps, eps_mesin, delta
	DOUBLE PRECISION f_a, f_b
	integer*2 counter, mandek_kiri, mandek_kanan
	counter = 0
	f_a = fungsi(a)
	f_b = fungsi(b)
	mandek_kanan = 1
	mandek_kiri = 1
	print*,"r","a","c","b","f(a)","f(c)","f(b)","Selang Baru","Lebarnya"
	do
		c = b - ((f_b*(b-a))/(f_b-f_a))
		if (abs(fungsi(c)).LT.eps_mesin) then
			!f(c) = 0, c adalah akar
			a = c
			b = c
		else
			if ((fungsi(a)*fungsi(c)).LT.0) then
				b = c
				f_b = fungsi(c)
				mandek_kiri = mandek_kiri + 1
				mandek_kanan = 0
				if (mandek_kiri.GT.1) then
					f_a = f_a / 2
				end if
			else
				a = c
				f_a = fungsi(c)
				mandek_kanan = mandek_kanan + 1
				mandek_kiri = 0
				if (mandek_kanan.GT.1) then
					f_b = f_b / 2
				end if
			end if
		end if
		
		if ((abs(a-b).LT.eps).OR.((abs(fungsi(c))).LT.delta)) then
			exit
		end if
	end do
	
end